﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Perceiveit.Xml;

namespace Perceiveit.Xml.Tests.Concrete
{
    public class ComplexChild : XEntity
    {
        public static XProperty<int> IDProperty = XProperty.Attribute<int>("id");
        private static XProperty<DateTime> _date = XProperty.Attribute<DateTime>("date");
        private static XProperty<int> _index = XProperty.Attribute<int>("index");
        private static XProperty<LocalString> _name = XProperty.Complex<LocalString>("name", Root.XmlNamespace);
        private static XProperty<LocalString> _desc = XProperty.Complex<LocalString>("description", Root.XmlNamespace);
        private static XProperty<Uri> _uri = XProperty.Text<Uri>("uri", Root.XmlNamespace);


        public int ID
        {
            get { return IDProperty.GetValue(this); }
            set { IDProperty.SetValue(this, value); }
        }

        public DateTime Date
        {
            get { return _date.GetValue(this); }
            set { _date.SetValue(this, value); }
        }

        public int Index
        {
            get { return _index.GetValue(this); }
            set { _index.SetValue(this, value); }
        }

        public LocalString Name
        {
            get { return _name.GetValue(this); }
            set { _name.SetValue(this, value); }
        }

        public LocalString Description
        {
            get 
            { 
                return _desc.GetValue(this);
            }
            set { _desc.SetValue(this, value); }
        }
    }

}
